#include<iostream>

using namespace std;

int main()
{
	int a[] = { 1,1,2,2,2,3,3,3,3,3,3,4,5 };
	//int a[] = {3,4};
	int left = 0; int right = sizeof(a) / sizeof(a[0])-1;
	
	while (left < right)
	{
		int mid = left+(right-left)/ 2;
		if (a[mid] >= 3) right = mid;
		else left = ++mid;
	}
	cout << left << endl;

	 left = 0;  right = sizeof(a) / sizeof(a[0]) - 1;
	while (left < right)
	{
		int mid = left + (right - left+1) / 2;
		if (a[mid] <= 3) left = mid;
		else right = --mid;
	}
	cout << right << endl;

	return 0;
}